import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import Vant, { Locale } from 'vant';
import 'vant/lib/index.css';
import './assets/css/reset.css'
import 'vant/lib/icon/local.css';//引用字体css
import i18n from './i18n/langs/index.js'
import 'lib-flexible/flexible.js'
import axios from "./utils/request";
import moment from "moment"
import './assets/css/index.scss'
import Cookie from "js-cookie"
import enUS from 'vant/lib/locale/lang/en-US';
import zhCN from 'vant/lib/locale/lang/zh-CN';
const cook = Cookie.get('site_lang') === 'en-US' ? enUS : zhCN
Locale.use(Cookie.get('site_lang'), cook);
Vue.use(Vant, i18n)

Vue.prototype.$axios = axios;

Vue.prototype.$moment = moment
Vue.config.productionTip = false;
getDictionarys()
async function getDictionarys () {
    // 字典接口
    const { data: res } = await axios.post('/api/dictionary/listDictionarysGroupBy', {})
    if (res.code == 200) {
        // 表格数据
        store.commit('listDictionarys', res.data)
    } else {
        console.log(res)
    }
}
// 设置标题，自定义指令
Vue.directive('wechat', {
    bind (el, obj) {
        document.title = obj.value;
    }
})
// 加载第三方项目的js
var jaq = jaq || [];
jaq.push(['account', 'JA2020_4532826']); //站点编号
jaq.push(['domain', 'ciftis.org']); //站点域名
jaq.push(['anchorpvflag', 'true']);
(function () {
    var ja = document.createElement('script');
    ja.type = 'text/javascript';
    ja.async = true;
    ja.src = '//wl.jd.com/joya.js';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(ja, s);
})();

new Vue({
    router,
    store,
    i18n,
    render: h => h(App)
}).$mount("#app");
